﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WIA;
using System.IO;

namespace TwainTest
{
    class Program
    {
        static void Main(string[] args)
        {
            ScanInterface.ScanAndSaveTo("a.bmp");
            //try
            //{
            //    DeviceManager manager = new DeviceManagerClass();
            //    Device device = null;
            //    foreach (DeviceInfo info in manager.DeviceInfos)
            //    {
            //        if (info.Type != WiaDeviceType.ScannerDeviceType)
            //            continue;
            //        device = info.Connect();
            //        break;
            //    }
            //    Item item = device.Items[1];
            //    CommonDialogClass cdc = new WIA.CommonDialogClass();
            //    ImageFile imageFile = cdc.ShowAcquireImage(WIA.WiaDeviceType.ScannerDeviceType,
            //                                    WIA.WiaImageIntent.TextIntent,
            //                                    WIA.WiaImageBias.MaximizeQuality, "{00000000-0000-0000-0000-000000000000}", true, true, false);
            //    if(imageFile!=null)
            //        imageFile.SaveFile("a.bmp");
            //    imageFile = cdc.ShowAcquireImage(WIA.WiaDeviceType.ScannerDeviceType,
            //                                    WIA.WiaImageIntent.TextIntent,
            //                                    WIA.WiaImageBias.MaximizeQuality, "{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}", true, true, false);
            //    if (imageFile != null)
            //        imageFile.SaveFile("b.bmp");
                
               
                
            //}
            //catch
            //{
            //    //MessageBox.Show("请检查扫描仪是否连接正确！", "提示...", MessageBoxButtons.OK,
            //    //MessageBoxIcon.Stop);
            //}
        }
    }
}
